<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<script type="text/javascript">
	$('#addTKpOrderOneBtn').linkbutton({   
	    iconCls: 'icon-add'  
	});  
	$('#delTKpOrderOneBtn').linkbutton({   
	    iconCls: 'icon-remove'  
	}); 
	$('#addTKpOrderOneBtn').bind('click', function(){   
 		 var tr =  $("#add_tKpOrderOne_table_template tr").clone();
	 	 $("#add_tKpOrderOne_table").append(tr);
	 	 resetTrNum('add_tKpOrderOne_table');
	 	 return false;
    });  
	$('#delTKpOrderOneBtn').bind('click', function(){   
      	$("#add_tKpOrderOne_table").find("input:checked").parent().parent().remove();   
        resetTrNum('add_tKpOrderOne_table'); 
        return false;
    }); 
    $(document).ready(function(){
    	$(".datagrid-toolbar").parent().css("width","auto");
    	if(location.href.indexOf("load=detail")!=-1){
			$(":input").attr("disabled","true");
			$(".datagrid-toolbar").hide();
		}
    });
    function countby1() {
        var orQty = 0;
        var cpTiji = 0;
        var count = 0;


        $tbody = $("#add_tKpOrderOne_table");
        $tbody.find('>tr').each(function(i) {
             orQty = 0;
             cpTiji = 0;
             count = 0;
            var $by1;
            $(':input, select,button,a', this).each(function () {
                var $this = $(this), validtype_str = $this.attr('validType'), name = $this.attr('name'),
                    id = $this.attr('id'), onclick_str = $this.attr('onclick'), val = $this.val() ,value = $this.attr('value');
                value = 1*value;
                if (name.indexOf("orQty") >= 0 ) {
                    if(value>0){
                        orQty = 1* value;
					}
                }

                if (name.indexOf("cpTiji") >= 0 ) {
                    if(value>0){
                        cpTiji = 1* value;
                    }
                }

                if (name.indexOf("by1") >= 0 ) {
                    $by1 = $this;
                }

            });
            count = orQty*cpTiji;
            count = count.toFixed(4)
            $by1.attr("value",count);


        });
    }

</script>
<div style="padding: 3px; height: 25px;width:auto;" class="datagrid-toolbar">
	 <a id="delTKpOrderOneBtn" href="#">删除</a>
</div>
<table border="0" cellpadding="2" cellspacing="0" id="tKpOrderOne_table">
	<tr bgcolor="#E6E6E6">
		<td align="center" bgcolor="#EEEEEE" style="width: 25px;">序号</td>
		<td align="center" bgcolor="#EEEEEE" style="width: 25px;">操作</td>
				  <%--<td align="left" bgcolor="#EEEEEE" style="width: 126px;">--%>
						<%--订单日期--%>
				  <%--</td>--%>
				  <%--<td align="left" bgcolor="#EEEEEE" style="width: 126px;">--%>
						<%--订单状态--%>
				  <%--</td>--%>
				  <%--<td align="left" bgcolor="#EEEEEE" style="width: 126px;">--%>
						<%--订单类型--%>
				  <%--</td>--%>
				  <%--<td align="left" bgcolor="#EEEEEE" style="width: 126px;">--%>
						<%--客户编码--%>
				  <%--</td>--%>
				  <%--<td align="left" bgcolor="#EEEEEE" style="width: 126px;">--%>
						<%--客户名称--%>
				  <%--</td>--%>
				  <%--<td align="left" bgcolor="#EEEEEE" style="width: 126px;">--%>
						<%--客户类型--%>
				  <%--</td>--%>
				  <%--<td align="left" bgcolor="#EEEEEE" style="width: 126px;">--%>
						<%--工地编码--%>
				  <%--</td>--%>
				  <%--<td align="left" bgcolor="#EEEEEE" style="width: 126px;">--%>
						<%--工地名称--%>
				  <%--</td>--%>
		<td align="left" bgcolor="#EEEEEE" style="width: 50px;">
			块数
		</td>
		<td align="left" bgcolor="#EEEEEE" style="width: 50px;">
			方量
		</td>
				  <td align="left" bgcolor="#EEEEEE" style="width: 60px;">
						产品编码
				  </td>
				  <td align="left" bgcolor="#EEEEEE" style="width: 50px;">
						产品名称
				  </td>
				  <td align="left" bgcolor="#EEEEEE" style="width: 70px;">
						规格
					</td>
				<td align="left" bgcolor="#EEEEEE" style="width: 50px;">
					等级
				</td>
				  <td align="left" bgcolor="#EEEEEE" style="width: 50px;">
						单位
				  </td>
		<td align="left" bgcolor="#EEEEEE" style="width: 50px;">
			单个体积
		</td>
				  <td align="left" bgcolor="#EEEEEE" style="width: 50px;">
						单价
				  </td>
				  <%--<td align="left" bgcolor="#EEEEEE" style="width: 126px;">--%>
						<%--托盘数--%>
				  <%--</td>--%>
				  <td align="left" bgcolor="#EEEEEE" style="width: 50px;">
						备注
				  </td>
				  <%--<td align="left" bgcolor="#EEEEEE" style="width: 126px;">--%>
						<%--订单号--%>
				  <%--</td>--%>
	</tr>
	<tbody id="add_tKpOrderOne_table">
	<c:if test="${fn:length(tKpOrderOneList)  <= 0 }">
			<tr>
				<td align="center"><div style="width: 25px;" name="xh">1</div></td>
				<td align="center"><input style="width:20px;"  type="checkbox" name="ck"/></td>
					<input name="tKpOrderOneList[0].id" type="hidden"/>
					<input name="tKpOrderOneList[0].createName" type="hidden"/>
					<input name="tKpOrderOneList[0].createBy" type="hidden"/>
					<input name="tKpOrderOneList[0].createDate" type="hidden"/>
					<input name="tKpOrderOneList[0].updateName" type="hidden"/>
					<input name="tKpOrderOneList[0].updateBy" type="hidden"/>
					<input name="tKpOrderOneList[0].updateDate" type="hidden"/>
					<input name="tKpOrderOneList[0].sysOrgCode" type="hidden"/>
					<input name="tKpOrderOneList[0].sysCompanyCode" type="hidden"/>
					<input name="tKpOrderOneList[0].bpmStatus" type="hidden"/>
					<input name="tKpOrderOneList[0].cpDengji" type="hidden"/>
					<input name="tKpOrderOneList[0].orAmount" type="hidden"/>
					<input name="tKpOrderOneList[0].by1" type="hidden"/>
					<input name="tKpOrderOneList[0].by2" type="hidden"/>
					<input name="tKpOrderOneList[0].by3" type="hidden"/>
					<input name="tKpOrderOneList[0].by4" type="hidden"/>
					<input name="tKpOrderOneList[0].by5" type="hidden"/>
					<input name="tKpOrderOneList[0].by6" type="hidden"/>
				  <td align="left">
							<input name="tKpOrderOneList[0].docDate" maxlength="32"  type="text" class="Wdate" onClick="WdatePicker()"  style="width:50px;"  ignore="ignore" >
					  <label class="Validform_label" style="display: none;">订单日期</label>
					</td>
				  <td align="left">
					  	<input name="tKpOrderOneList[0].orStatus" maxlength="32" type="text" class="inputxt"  style="width:50px;"  ignore="ignore" >
					  <label class="Validform_label" style="display: none;">订单状态</label>
					</td>
				  <td align="left">
					  	<input name="tKpOrderOneList[0].orderType" maxlength="32" type="text" class="inputxt"  style="width:50px;"  ignore="ignore" >
					  <label class="Validform_label" style="display: none;">订单类型</label>
					</td>
				  <td align="left">
					  	<input name="tKpOrderOneList[0].cusCode" maxlength="32" type="text" class="inputxt"  style="width:50px;"  ignore="ignore" >
					  <label class="Validform_label" style="display: none;">客户编码</label>
					</td>
				  <td align="left">
					  	<input name="tKpOrderOneList[0].cusName" maxlength="132" type="text" class="inputxt"  style="width:50px;"  ignore="ignore" >
					  <label class="Validform_label" style="display: none;">客户名称</label>
					</td>
				  <td align="left">
					  	<input name="tKpOrderOneList[0].cusType" maxlength="32" type="text" class="inputxt"  style="width:50px;"  ignore="ignore" >
					  <label class="Validform_label" style="display: none;">客户类型</label>
					</td>
				  <td align="left">
					  	<input name="tKpOrderOneList[0].gdCode" maxlength="32" type="text" class="inputxt"  style="width:50px;"  ignore="ignore" >
					  <label class="Validform_label" style="display: none;">工地编码</label>
					</td>
				  <td align="left">
					  	<input name="tKpOrderOneList[0].gdName" maxlength="132" type="text" class="inputxt"  style="width:50px;"  ignore="ignore" >
					  <label class="Validform_label" style="display: none;">工地名称</label>
					</td>
				  <td align="left">
					  	<input name="tKpOrderOneList[0].cpCode" maxlength="32" type="text" class="inputxt"  style="width:50px;"  ignore="ignore" >
					  <label class="Validform_label" style="display: none;">产品编码</label>
					</td>
				  <td align="left">
							 <input  id="tKpOrderOneList[0].cpName" name="tKpOrderOneList[0].cpName" type="text" style="width: 150px" class="searchbox-inputtext"  value="${poVal.cpName }"   ignore="ignore"   onclick="popupClick(this,'1','1','pop_kp_jiage_one')"/> 			 
					  <label class="Validform_label" style="display: none;">产品名称</label>
					</td>
				  <td align="left">
					  	<input name="tKpOrderOneList[0].cpGuige" maxlength="32" type="text" class="inputxt"  style="width:50px;"  ignore="ignore" >
					  <label class="Validform_label" style="display: none;">规格</label>
					</td>
				  <td align="left">
					  	<input name="tKpOrderOneList[0].cpJifei" maxlength="32" type="text" class="inputxt"  style="width:50px;"  ignore="ignore" >
					  <label class="Validform_label" style="display: none;">单位</label>
					</td>
				  <td align="left">
					  	<input name="tKpOrderOneList[0].orQty" maxlength="32" type="text" class="inputxt"  style="width:50px;"  ignore="ignore" >
					  <label class="Validform_label" style="display: none;">数量</label>
					</td>
				  <td align="left">
					  	<input name="tKpOrderOneList[0].cpJiage" maxlength="32" type="text" class="inputxt"  style="width:50px;"  ignore="ignore" >
					  <label class="Validform_label" style="display: none;">单价</label>
					</td>
				  <%--<td align="left">--%>
					  	<%--<input name="tKpOrderOneList[0].orTuopan" maxlength="32" type="text" class="inputxt"  style="width:50px;" 		datatype="n" ignore="checked" >--%>
					  <%--<label class="Validform_label" style="display: none;">托盘数</label>--%>
					<%--</td>--%>
				  <td align="left">
					  	<input name="tKpOrderOneList[0].orRemark" maxlength="132" type="text" class="inputxt"  style="width:50px;"  ignore="ignore" >
					  <label class="Validform_label" style="display: none;">备注</label>
					</td>
				  <td align="left">
					  	<input name="tKpOrderOneList[0].kpId" maxlength="32" type="text" class="inputxt"  style="width:50px;"  ignore="ignore" >
					  <label class="Validform_label" style="display: none;">订单号</label>
					</td>
   			</tr>
	</c:if>
	<c:if test="${fn:length(tKpOrderOneList)  > 0 }">
		<c:forEach items="${tKpOrderOneList}" var="poVal" varStatus="stuts">
			<tr>
				<td align="center"><div style="width: 25px;" name="xh">${stuts.index+1 }</div></td>
				<td align="center"><input style="width:20px;"  type="checkbox" name="ck" /></td>
						<input name="tKpOrderOneList[${stuts.index }].id" type="hidden" value="${poVal.id }"/>
						<input name="tKpOrderOneList[${stuts.index }].createName" type="hidden" value="${poVal.createName }"/>
						<input name="tKpOrderOneList[${stuts.index }].createBy" type="hidden" value="${poVal.createBy }"/>
						<input name="tKpOrderOneList[${stuts.index }].createDate" type="hidden" value="${poVal.createDate }"/>
						<input name="tKpOrderOneList[${stuts.index }].updateName" type="hidden" value="${poVal.updateName }"/>
						<input name="tKpOrderOneList[${stuts.index }].updateBy" type="hidden" value="${poVal.updateBy }"/>
						<input name="tKpOrderOneList[${stuts.index }].updateDate" type="hidden" value="${poVal.updateDate }"/>
						<input name="tKpOrderOneList[${stuts.index }].sysOrgCode" type="hidden" value="${poVal.sysOrgCode }"/>
						<input name="tKpOrderOneList[${stuts.index }].sysCompanyCode" type="hidden" value="${poVal.sysCompanyCode }"/>
						<input name="tKpOrderOneList[${stuts.index }].bpmStatus" type="hidden" value="${poVal.bpmStatus }"/>
						<%--<input name="tKpOrderOneList[${stuts.index }].cpDengji" type="hidden" value="${poVal.cpDengji }"/>--%>
						<input name="tKpOrderOneList[${stuts.index }].orAmount" type="hidden" value="${poVal.orAmount }"/>
						<%--<input name="tKpOrderOneList[${stuts.index }].by1" type="hidden" value="${poVal.by1 }"/>--%>
						<input name="tKpOrderOneList[${stuts.index }].by2" type="hidden" value="${poVal.by2 }"/>
						<input name="tKpOrderOneList[${stuts.index }].by3" type="hidden" value="${poVal.by3 }"/>
						<input name="tKpOrderOneList[${stuts.index }].by4" type="hidden" value="${poVal.by4 }"/>
						<input name="tKpOrderOneList[${stuts.index }].by5" type="hidden" value="${poVal.by5 }"/>
						<input name="tKpOrderOneList[${stuts.index }].by6" type="hidden" value="${poVal.by6 }"/>
				   <%--<td align="left">--%>
							<%--<input name="tKpOrderOneList[${stuts.index }].docDate" maxlength="32" type="text" class="Wdate" onClick="WdatePicker()"  style="width:50px;"   ignore="ignore"  value="<fmt:formatDate value='${poVal.docDate}' type="date" pattern="yyyy-MM-dd"/>"/>--%>
					  <%--<label class="Validform_label" style="display: none;">订单日期</label>--%>
				   <%--</td>--%>
				   <%--<td align="left">--%>
					  	<%--<input name="tKpOrderOneList[${stuts.index }].orStatus" maxlength="32" type="text" class="inputxt"  style="width:50px;"  ignore="ignore"  value="${poVal.orStatus }"/>--%>
					  <%--<label class="Validform_label" style="display: none;">订单状态</label>--%>
				   <%--</td>--%>
				   <%--<td align="left">--%>
					  	<%--<input name="tKpOrderOneList[${stuts.index }].orderType" maxlength="32" type="text" class="inputxt"  style="width:50px;"  ignore="ignore"  value="${poVal.orderType }"/>--%>
					  <%--<label class="Validform_label" style="display: none;">订单类型</label>--%>
				   <%--</td>--%>
				   <%--<td align="left">--%>
					  	<%--<input name="tKpOrderOneList[${stuts.index }].cusCode" maxlength="32" type="text" class="inputxt"  style="width:50px;"  ignore="ignore"  value="${poVal.cusCode }"/>--%>
					  <%--<label class="Validform_label" style="display: none;">客户编码</label>--%>
				   <%--</td>--%>
				   <%--<td align="left">--%>
					  	<%--<input name="tKpOrderOneList[${stuts.index }].cusName" maxlength="132" type="text" class="inputxt"  style="width:50px;"  ignore="ignore"  value="${poVal.cusName }"/>--%>
					  <%--<label class="Validform_label" style="display: none;">客户名称</label>--%>
				   <%--</td>--%>
				   <%--<td align="left">--%>
					  	<%--<input name="tKpOrderOneList[${stuts.index }].cusType" maxlength="32" type="text" class="inputxt"  style="width:50px;"  ignore="ignore"  value="${poVal.cusType }"/>--%>
					  <%--<label class="Validform_label" style="display: none;">客户类型</label>--%>
				   <%--</td>--%>
				   <%--<td align="left">--%>
					  	<%--<input name="tKpOrderOneList[${stuts.index }].gdCode" maxlength="32" type="text" class="inputxt"  style="width:50px;"  ignore="ignore"  value="${poVal.gdCode }"/>--%>
					  <%--<label class="Validform_label" style="display: none;">工地编码</label>--%>
				   <%--</td>--%>
				   <%--<td align="left">--%>
					  	<%--<input name="tKpOrderOneList[${stuts.index }].gdName" maxlength="132" type="text" class="inputxt"  style="width:50px;"  ignore="ignore"  value="${poVal.gdName }"/>--%>
					  <%--<label class="Validform_label" style="display: none;">工地名称</label>--%>
				   <%--</td>--%>
				<td align="left">
					<input name="tKpOrderOneList[${stuts.index }].orQty" maxlength="32" type="text" oninput="countby1()" class="inputxt"  style="width:50px;"  on	datatype="n"    value="${poVal.orQty }"/>
					<label class="Validform_label" style="display: none;">块数</label>
				</td>
				<td align="left">
					<input name="tKpOrderOneList[${stuts.index }].by1" maxlength="32" type="text" class="inputxt"  style="width:50px;"    ignore="ignore"  value="${poVal.by1 }"/>
					<label class="Validform_label" style="display: none;">方量</label>
				</td>
				   <td align="left">
					  	<input name="tKpOrderOneList[${stuts.index }].cpCode" maxlength="32" type="text" class="inputxt"  style="width:60px;"  readonly="readonly"  ignore="ignore"  value="${poVal.cpCode }"/>
					  <label class="Validform_label" style="display: none;">产品编码</label>
				   </td>
				   <td align="left">
							 <input  id="tKpOrderOneList[${stuts.index }].cpName" name="tKpOrderOneList[${stuts.index }].cpName"  type="text"  readonly="readonly" style="width: 50px" class="searchbox-inputtext"   ignore="ignore"  onclick="popupClick(this,'1','1','pop_kp_jiage_one')"    value="${poVal.cpName }" />
					  <label class="Validform_label" style="display: none;">产品名称</label>
				   </td>
				   <td align="left">
					  	<input name="tKpOrderOneList[${stuts.index }].cpGuige" maxlength="32" type="text" class="inputxt"  style="width:70px;"  readonly="readonly"  ignore="ignore"  value="${poVal.cpGuige }"/>
					  <label class="Validform_label" style="display: none;">规格</label>
				   </td>
				<td align="left">
					<input name="tKpOrderOneList[${stuts.index }].cpDengji" maxlength="32" type="text" class="inputxt"  style="width:50px;"  readonly="readonly"  ignore="ignore"  value="${poVal.cpDengji }"/>
					<label class="Validform_label" style="display: none;">等级</label>
				</td>
				   <td align="left">
					  	<input name="tKpOrderOneList[${stuts.index }].cpJifei" maxlength="32" type="text" class="inputxt"  style="width:50px;"  readonly="readonly"  ignore="ignore"  value="${poVal.cpJifei }"/>
					  <label class="Validform_label" style="display: none;">单位</label>
				   </td>
				<td align="left">
					<input name="tKpOrderOneList[${stuts.index }].cpTiji" maxlength="32" type="text" class="inputxt"  style="width:50px;"  readonly="readonly" ignore="ignore"  value="${poVal.cpTiji }"/>
					<label class="Validform_label" style="display: none;">单个体积</label>
				</td>
				   <td align="left">
					  	<input name="tKpOrderOneList[${stuts.index }].cpJiage" maxlength="32" type="text" class="inputxt"  style="width:50px;"   readonly="readonly" ignore="ignore"  value="${poVal.cpJiage }"/>
					  <label class="Validform_label" style="display: none;">单价</label>
				   </td>
				   <%--<td align="left">--%>
					  	<%--<input name="tKpOrderOneList[${stuts.index }].orTuopan" maxlength="32" type="text" class="inputxt"  style="width:50px;"    value="${poVal.orTuopan }"/>--%>
					  <%--<label class="Validform_label" style="display: none;">托盘数</label>--%>
				   <%--</td>--%>
				   <td align="left">
					  	<input name="tKpOrderOneList[${stuts.index }].orRemark" maxlength="132" type="text" class="inputxt"  style="width:50px;"    ignore="ignore"  value="${poVal.orRemark }"/>
					  <label class="Validform_label" style="display: none;">备注</label>
				   </td>
				   <%--<td align="left">--%>
					  	<%--<input name="tKpOrderOneList[${stuts.index }].kpId" maxlength="32" type="text" class="inputxt"  style="width:50px;"  readonly="readonly" ignore="ignore"  value="${poVal.kpId }"/>--%>
					  <%--<label class="Validform_label" style="display: none;">订单号</label>--%>
				   <%--</td>--%>
   			</tr>
		</c:forEach>
	</c:if>	
	</tbody>
</table>
